<template>
  <div class="dog">
    <img 
     :src= 'address' alt=""
   >
   <p :style="{'background-color': colors}" @click="btn">{{msg}}</p>
  </div>
</template>

<script>
export default {
 props: ['address','msg','index'],
 data() {
  return {
   colors:'',
  }
 },
 methods: {
  btn() {
    this.colors = `rgb(${Math.floor(Math.random()*256)},${Math.floor(Math.random()*256)},${Math.floor(Math.random()*256)})`
    this.$emit('like',this.msg)
  }
 }
}
</script>

<style scoped>
.dog {
  width: 200px;
  border: 1px solid black;
  text-align: center;
  float: left;
}
img {
  width: 100%;
  height: 200px;
}
</style>